
package combat.example.protocol.data;

import combat.example.protocol.interfaces.OrderInt;
import combat.example.protocol.types.OrderType;


/**
 * 
 * @author Laurens Andriessen
 * @version 1.0
 */
public class Order implements OrderInt {

	private static final long serialVersionUID = 1L;

	private int orderID = -1;
	private DoublePoint target = null;
	private OrderType type = OrderType.UNKNOWN;

	public Order() {}
	public Order(int userID, DoublePoint target, OrderType type) {
		this.orderID = userID;
		this.target = target;
		this.type = type;
	}

	public int getOrderID() {
		return orderID;
	}
	public void setOrderID(int orderID) {
		this.orderID = orderID;
	}

	public DoublePoint getTarget() {
		return (target == null) ? new DoublePoint() : target;
	}
	public void setTarget(DoublePoint target) {
		this.target = target;
	}

	public OrderType getType() {
		return type;
	}
	public void setType(OrderType type) {
		this.type = type;
	}

	// Subclass Move
	class Move extends Order implements OrderInt.MovementInt {

		private static final long serialVersionUID = 1L;

		public Move(int userID, DoublePoint target) {
			super(userID, target, OrderType.MOV);
		}

		private double speed = 0.0;
		public double getSpeed() {
			return speed;
		}
		public void setSpeed(double speed) {
			this.speed = speed;
		}

	}

	// Subclass Attack
	class Attack extends Order implements OrderInt.AttackInt {

		private static final long serialVersionUID = 1L;

		public Attack(int userID, DoublePoint target) {
			super(userID, target, OrderType.ATK);
		}

		private int systemID;
		public int getSystemID() {
			return systemID;
		}
		public void setSystemID(int systemID) {
			this.systemID = systemID;
		}

		// TODO Disable comments on this part!
		/*
		 * private OnboardSystem weaponID = -1; public OnboardSystem
		 * getWeaponID() { return weaponID; } public void
		 * setWeaponID(OnboardSystem weaponID) { this.weaponID = weaponID; }
		 */
	}
}
